// IdCardTypeEnum.java
package com.leo.train.common.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum IdCardTypeEnum implements BaseEnum {
    ID_CARD("1", "身份证"),
    PASSPORT("2", "护照"),
    HK_MACAO("3", "港澳通行证");

    private final String code;
    private final String description;

    IdCardTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @JsonValue
    public String getCode() {
        return code;
    }

    public static IdCardTypeEnum fromCode(String code) {
        for (IdCardTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}
